home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / C and C++ / System / sicn ldef ƒ / xDEF tester.c < prev   
Text File  |  1989-12-19  |  1KB  |  55 lines

  1. /*
  2.     xDEF tester.c
  3.     Copyright 1989 Josh Pritikin
  4.     All rights reserved.
  5.     
  6.     This code may be used freely in any programming project, no string attached.
  7.     
  8.     To use this general xDEF testing code all you need to do is create a
  9.     resource (any size) of the kind of xDEF you want to test.  Then call the
  10.     routine below with the type, id and real procedure for the particular
  11.     xDEF.  Your xDEF need to be in a lock segment of your application.
  12.     
  13.     
  14.     Change History
  15.  
  16. 12.19.89    Created and tested.
  17. 12.19.89    v1.0 Release
  18.     
  19.     I can be reached at different speed at:
  20.     
  21. fast ->
  22.     internet: 6500stom@ucsbuxa.ucsb.edu
  23.     AppleLink: 6500stom%ucsbuxa@hub.ucsb.edu@DASNET#
  24.     CIS: 70771,2131@(internet gateway...)
  25. slow ->
  26.     GEnie: J.Pritikin
  27.     AppleLink: Josh.P
  28. very slow ->
  29.     CIS: 70771,2131
  30. */
  31.  
  32. typedef struct {
  33.     int        jump;
  34.     void*    add;
  35. } defRec, *defPtr, **defHdl;
  36.  
  37. Boolean InitXDEF(long type, int id, void* realdef)
  38. {
  39.     defHdl    thedef;
  40.     
  41.     thedef = GetResource(type, id);
  42.     if (!thedef) {
  43.         DebugStr("\pCouldn't get XDEF resource.");
  44.         return true;
  45.     }
  46.     
  47.     HNoPurge(thedef);
  48.     SetHandleSize(thedef, sizeof(defRec));
  49.     
  50.     (**thedef).jump = 0x4ef9;
  51.     (**thedef).add = realdef;
  52.     
  53.     return false;
  54. }
  55.